<?php
/**
 * Created by PhpStorm.
 * User: alei
 * Date: 11/5/2017 AD
 * Time: 17:09
 */
namespace App\Models\Mysql\tonggao;

//use Illuminate\Database\Eloquent\Model;
use App\Models\Traits\BaseDBMethod;

class sentence
{
	use BaseDBMethod;
	//数据库连接配置项，见config/database.php
	const DATABASE_CONF = 'tonggao_mysql';
	//pre_ct_ui 首页轮播图所在表
	const TABLE_NAME = 'term';

	//数据库连接配置项，见config/database.php
	//如果需要用ORM，需要设置此项
//	protected $connection = self::DATABASE_CONF;
	//表名，如果需要用ORM，需要设置此项
//	protected $table = self::TABLE_NAME;

	public static function select($sql)
	{
		return self::getConnObj()->select($sql);
	}

	public static function update($sql)
	{
		return self::getConnObj()->update($sql);
	}

	#取句对语信息和修改记录
	public static function sentence_info($p)
	{
		$ids = implode(',', $p);
		return self::getConnObj()->select(
			"SELECT a.id,a.seq_no,a.content ,a.translation,c.translation as translation_log ,c.modifier,c.modify_time,c.comment from sentence a left join sentence_log c on a.id=c.sentence_id  where c.sentence_id in($ids)
			 order by c.modify_time desc"
	    );
	}
	
}

?>